<div class="dialog-toolbar">
    <a class="easyui-linkbutton" iconCls="icon-ok" plain="true" onclick="easyui.treeCheckAll('role_menu')">全选</a>
    <a class="easyui-linkbutton" iconCls="icon-reload" plain="true" onclick="easyui.treeUnCheckAll('role_menu')">反选</a>
</div>
<div class="content-layout">
    <ul id="role_menu" class="easyui-tree" data-options="url:'{:U('menu/tree?checked=' . $menu_id)}', fit:true, checkbox: true, cascadeCheck: true"></ul>
</div>
<script type="text/javascript">
    var role_id = '{$role_id}';
    function onConfirm(){
        var role_menu = $('#role_menu');
        var nodes = role_menu.tree('getChecked');
        var ids = [];
        for(var i = 0; i < nodes.length; i++){
            ids.push(nodes[i].id);
        }
        var result = easyui.AjaxCall("{:U('role/save')}", {menu_id: ids.join(','), role_id: role_id, scrap: true}, null);
        if(result.message){
            easyui.alert(result.message);
        }
        if(result.success > 0) return result;
    }
</script>